<?php

namespace App\Jobs;

use App\Services\MediaService;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class MediaQueue implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $params;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($params)
    {
        $this->params = $params;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $parms = $this->params;
        $data = $parms['data'];

        $action = $parms['action'];

        $result = $this->$action($data);

        return $result;
    }

    /*
     * 删除视频
     * */
    public function del($params)
    {
        $media_id = $params['media_id'];

        $result = MediaService::change_ranking($media_id);
    }

}
